home *** CD-ROM | disk | FTP | other *** search
- <?php
- /*
- ** $Id: services.php,v 1.5 2005/05/30 18:31:43 hmailserver Exp $
- **
- ** hMailServer - Web interface
- **
- ** File formatted using TAB size 4
- **
- ** Get hMailserver at http://www.hmailserver.com
- **
- ** Author: Steen Rab°l <srabol@mail.tele.dk>
- ** Copyright (c) 2004, Steen Rab°l <srabol@mail.tele.dk>
- **
- ** This program is free software; you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** You may not change or alter any portion of this comment or credits
- ** of supporting developers from this source code or any supporting
- ** source code which is considered copyrighted (c) material of the
- ** original comment or credit authors.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- **
- */
-
- if (hmailGetAdminLevel() != 2)
- hmailHackingAttemp();
-
- $serverstate = $obBaseApp->ServerState();
- $function = hmailGetVar("function","");
- $obSettings = $obBaseApp->Settings();
- $obUtilities = $obBaseApp->Utilities();
- $hmailSmarty->assign("servertype","hMailServer");
-
- switch($function)
- {
- case "startserver":
- $obBaseApp->Start(); // Start server
- sleep(2);
- header("refresh:0 url=index.php?page=services");
- exit();
- break;
-
- case "stopserver":
- $obBaseApp->Stop(); // Stop server - POP3 server
- sleep(2);
- header("refresh:0 url=index.php?page=services");
- exit();
- break;
-
- case "save":
-
- $obSettings->serviceIMAP = (hmailGetVar("ServerIMAP") == 1 ? true : false);
- $obSettings->serviceSMTP = (hmailGetVar("ServerSMTP") == 1 ? true : false);
- $obSettings->servicePOP3 = (hmailGetVar("ServerPOP3") == 1 ? true : false);
- break;
-
- default:
- break;
- }
-
- switch($serverstate)
- {
- case 1:
- $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_stopped"));
- $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("start_server"));
- $hmailSmarty->assign("buttonaction","startserver");
- break;
-
- case 2:
- $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_startpending"));
- $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("stop_server"));
- $hmailSmarty->assign("buttonaction","stopserver");
- break;
-
- case 3:
- $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_running"));
- $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("stop_server"));
- $hmailSmarty->assign("buttonaction","stopserver");
- break;
-
- case 4:
- $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_stoppending"));
- $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("stop_server"));
- $hmailSmarty->assign("buttonaction","stopserver");
- break;
-
- default:
- $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_unknownstate"));
- $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("stop_server"));
- $hmailSmarty->assign("buttonaction","stopserver");
- break;
- }
-
- $hmailSmarty->assign("smtpcheck",($obSettings->ServiceSMTP == true ? "checked" : ""));
- $hmailSmarty->assign("pop3check", ($obSettings->ServicePOP3 == true ? "checked" : ""));
- $hmailSmarty->assign("imapcheck" , ($obSettings->ServiceIMAP == true ? "checked" : ""));
- $hmailSmarty->assign("pagecontent", $hmailSmarty->fetch('services.tpl'));
- ?>